package day03;
//逻辑运算符
public class OperDemo3 {
    public static void main(String[] args) {
        //逻辑运算符，逻辑与 逻辑或 逻辑非 均对布尔值操作
       /* int age = 40;
        System.out.println(age>=18 && age<=50);//true
        int score = 86;
        System.out.println(score>=0 && score<=100);//true

        */
        int a =5,b=10,c=5;
        System.out.println(a==c && c>b);//false
        System.out.println(a==c && c!=b);//true
        System.out.println(a==c || c>b);//true
        System.out.println(!(a<c));//true

    }

    //短路与和短路或
    public static class OperDemo4 {
        public static void main(String[] args) {
            int a =5,b=10, c = 5;
            boolean a1 = a>b && c++>2;//false短路与
            System.out.println(a1);
            System.out.println(c);//发现短路了，c++没有运行
            boolean b1 = a<b || c++>2;//ture 短路或
            System.out.println(b1);
            System.out.println(c);// 发现短路 c++没有运行
        }
    }
}
